package com.heima.feign.clients;

import com.heima.feign.clients.fallback.ArticleClientFallbackFactory;
import com.heima.feign.config.HeimaFeignAutoConfiguration;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "leadnews-article", fallbackFactory = ArticleClientFallbackFactory.class, configuration = HeimaFeignAutoConfiguration.class)
public interface ArticleClient {

    @GetMapping("/api/v1/author/findByUserId/{userId}")
    public ResponseResult<ApAuthor> findByUserId(@PathVariable("userId") Integer userId);

    @PostMapping("/api/v1/author/save")
    public ResponseResult save(@RequestBody ApAuthor apAuthor);

}
